package io.renren.modules.pro.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.pro.dao.ItemDao;
import io.renren.modules.pro.entity.ItemEntity;
import io.renren.modules.pro.service.ItemService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author yue.zhang
 */
@Service("itemService")
public class ItemServiceImpl extends ServiceImpl<ItemDao, ItemEntity> implements ItemService {



	@Override
	public PageUtils queryPage(Map<String, Object> params) {
		String title = (String)params.get("title");
		IPage<ItemEntity> page = this.page(
				new Query<ItemEntity>().getPage(params)
				, new QueryWrapper<ItemEntity>().like(StringUtils.isNotBlank(title),"title", title));
		return new PageUtils(page);
	}



}
